/*
程序说明：
读取/proc目录下的cpuinfo文件和meninfo文件，
获取cpu信息和mem信息
创建两个子函数，分别用于获取cpu信息和men信息
*/
# include "stdio.h"
# include "time.h"
# include <unistd.h>
//# include "iostream.h"
//using namespace std;

void cpu()
{
	/*printf("以下是mem/cpu info的信息：\n");
	FILE *cpufp,*memfp;
	cpufp=fopen("/proc/cpuinfo","r");
	memfp=fopen("/proc/meminfo","r");
	char buffer[100];
	int i=0,o=0;
	/*while(1)
	{
		for (;i<1;i++)
		{
		fgets(buffer,100,cpufp);
		printf("%s",buffer);
		}
		sleep(0.1);
	}*//*
	clock_t start,finish;
	start=clock();
	double time=0.00;*/
	int i=0;
	while(1)
	{
		sleep(1);
		printf("%d\n",i);
		i++;
	}
	/*while (1)
	{
		finish=clock();
		time=(double)((finish-start)/CLOCKS_PER_SEC)/1;
		i=(int)time;
		if (i!=o)
		{
			fgets(buffer,100,memfp);
			fseek(memfp,120L,0);
			printf("%d:%s",i,buffer);
			o++;
		}
		
	}
	fclose(memfp);
	fclose(cpufp);*/
}



void main()
{
	cpu();
}
